package com.mashang.stuManSystem.controller;

import com.mashang.stuManSystem.entity.Clazz;
import com.mashang.stuManSystem.entity.vo.ClazzVo;
import com.mashang.stuManSystem.mapping.ClazzMapping;
import com.mashang.stuManSystem.service.IClazzService;
import com.mashang.stuManSystem.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/class")
@Api(tags = "全部班级模块")
public class ClazzAllController {

    @Autowired
    private IClazzService service;

    @ApiOperation("查询班级列表")
    @GetMapping("/name")
    public R<List<ClazzVo>> queryList(){
        return R.success(ClazzMapping.INSTANCE.toClazzVoList(service.list()));
    }
}
